class Solution {
public:
    int maximumEnergy(vector<int>& energy, int k) {
        int n=energy.size();
        for(int i=n-1; i>=k; i--) 
            energy[i-k]+=energy[i];
        
        return ranges::max(energy);
    }
};